import java.util.ArrayList;
import java.util.Scanner;
//plantarlo leeyendo la cedena y contando intervalo
public class CartasDelAbuelo {
	public static Scanner leer;
	public static void main(String[] args) {
			leer = new Scanner(System.in);
			String cadena;
			int num_inter=1;
			int max, min,aux;
			while(num_inter>0){
				cadena = leer.nextLine();
				num_inter = convertir(leer);
				for(int i=0;i<num_inter;i++){
					max = leer.nextInt();
					min = convertir(leer);
					if(max<min){
						aux=max;
						max = min;
						min =aux;
					}
					boolean igual =true;
					if (max< cadena.length() && max >=0 && min >=0){
						if(min<max){
							for(int j =min, k=max;j<=max && igual && k>=j ;j++, k--){
								if(cadena.charAt(j)!=cadena.charAt(j+1) || cadena.charAt(k)!=cadena.charAt(k-1)){
									igual=false;
								}
							}
						}	
					}else
						igual=false;
					if(igual){
						System.out.println("SI");
					}else
						System.out.println("NO");
				}
				System.out.println();
				
				
			}

	}
	public static int convertir(Scanner a){
		String aux = a.nextLine();
		aux=aux.trim();
		return Integer.parseInt(aux);
	}
	public static ArrayList<int[]> leerCadena(){
		int cad[]= new int[2];
		ArrayList <int[]> ar = new ArrayList<int[]>();
		char a = '.';
		char b='-';
		int i =-1;
		int j =-1;
		int cont=0;
		while(b !='\n' && a !='\n'){
			a = (char) leer.nextByte();
			//b= (char) leer.nextByte();
			if(a==b){
				if(i==-1)
					i=cont;
			}else{
				if(i!=-1){
					j=cont;
				}
			}
			cont++;
			if(i!=0){
				cad = new int[2];
				cad[0]=i;
				cad[1]=j;
				//guardar en el arryaList
				ar.add(cad);
				i=-1;
				j=-1;
			}
		}
			
		return ar;
	}
}
